home *** CD-ROM | disk | FTP | other *** search
- Path: news.NetVision.net.il!news
- From: ggil@netvision.net.il
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Q:Hex to Decimal?
- Date: Sat, 13 Apr 96 19:10:18 PDT
- Organization: NetVision LTD.
- Message-ID: <NEWTNews.829447901.13807.ggil@dialup.netvision.net.il>
- References: <316D2289.4759@tricon.net>
- NNTP-Posting-Host: ts000p15.pop9a.netvision.net.il
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage
-
-
- In Article<316D2289.4759@tricon.net>, <tacooper@tricon.net> writes:
- > Path: news.NetVision.net.il!psinntp!psinntp!psinntp!howland.reston.ans.net!newsfeed.internetmci.com!in2.uu.net!news.tricon.net!usenet
- > From: Thomas A Cooper <tacooper@tricon.net>
- > Newsgroups: comp.lang.c,comp.lang.c++
- > Subject: Q:Hex to Decimal?
- > Date: Thu, 11 Apr 1996 11:17:29 -0400
- > Organization: Tri-Cities Connection
- > Lines: 13
- > Message-ID: <316D2289.4759@tricon.net>
- > NNTP-Posting-Host: pm1-13.tricon.net
- > Mime-Version: 1.0
- > Content-Type: text/plain; charset=us-ascii
- > Content-Transfer-Encoding: 7bit
- > X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
- > Xref: news.NetVision.net.il comp.lang.c:9794 comp.lang.c++:11749
- >
- > I saw in a magazine a simple function to convert a HEX string to an
- > integer:
- >
- > long int FAR PASCAL hex2int(char far *s)
- > {
- > return strtol(s,NULL,16);
- > }
- >
- > I'm struggling with the reverse situation, a function to convert an
- > integer into a HEX string. Anybody got any ideas?? Thanks in advance for
- > your help.
- > Tom Cooper
- > tacooper@tricon.net
-
- just use
- sprintf(string, "%x", i)
-
-
- ggil@netvision.net.il
-
-
-